<% /* $Id: submission.jsp 132 2011-08-26 10:23:42Z altdotua@gmail.com $ */ %>

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@include file="../header.jsp"%>

<%
	SubmissionEntry s = SubmissionsModel.getSubmission(Long.parseLong(request.getParameter("submission_id")));
	if (null == s)
	{
		response.sendRedirect(Linker.link("contests/admin/submissions.jsp?contest_id=" + contest.getId()));
		return;
	}
%>

<form action="<%= Linker.link("submissions") %>" method="post">
	<input type="hidden" name="id" value="<%= s.getId() %>">
	<input type="hidden" name="contestId" value="<%= contest.getId() %>">
	<input type="hidden" name="action" value="customEdit">
	<input type="hidden" name="return" value="<%= request.getParameter("return") != null ? request.getParameter("return") : requestUrl %>">
	<table border="1">
		<tr>
			<td>ID</td>
			<td><%= s.getId() %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>User</td>
			<td><%= /*ContestUsersModel.getEntry(contest.getId(), s.getContestId())*/ UsersModel.getUser(s.getUserId()) %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>Problem</td>
			<td><%= ContestProblemsModel.getEntry(s.getContestProblemId())  %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>Language</td>
			<td><%= LanguagesModel.getEntry(s.getLanguageId())  %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>Submitted</td>
			<td><%= s.getSubmissionTime()  %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>Score</td>
			<td><input type="text" value="<%= s.getScore() %>" name="Score" maxlength="10" size="10"></td>
			<td><input type="submit" value="Change" name="EditScore"></td>
		</tr>
		<tr>
			<td>MaxTimeUsed</td>
			<td><input type="text" value="<%= s.getMaxTimeUsed() %>" name="MaxTimeUsed" maxlength="10" size="10"></td>
			<td><input type="submit" value="Change" name="EditMaxTimeUsed"></td>
		</tr>
		<tr>
			<td>WrongTestNumber</td>
			<td><input type="text" value="<%= s.getWrongTestNumber() %>" name="WrongTestNumber" maxlength="10" size="10"></td>
			<td><input type="submit" value="Change" name="EditWrongTestNumber"></td>
		</tr>
		<tr>
			<td>FlagFirstTestOnly</td>
			<td><input type="checkbox" name="FlagFirstTestOnly" <%= s.getFlagFirstTestOnly() ? "checked=\"checked\"" : "" %> >FlagFirstTestOnly</td>
			<td><input type="submit" value="Change" name="EditFlagFirstTestOnly"></td>
		</tr>
		<tr>
			<td>Virtual</td>
			<td><input type="checkbox" name="Virtual" <%= s.getVirtual() ? "checked=\"checked\"" : "" %> >Virtual</td>
			<td><input type="submit" value="Change" name="EditVirtual"></td>
		</tr>
		<tr>
			<td>Active</td>
			<td><input type="checkbox" name="Active" <%= s.getActive() ? "checked=\"checked\"" : "" %> >Active</td>
			<td><input type="submit" value="Change" name="EditActive"></td>
		</tr>
			<tr>
			<td>MaxMemoryUsed</td>
			<td><input type="text" value="<%= s.getMaxMemoryUsed() %>" name="MaxMemoryUsed" maxlength="10" size="10"></td>
			<td><input type="submit" value="Change" name="EditMaxMemoryUsed"></td>
		</tr>
		<tr>
			<td>Judgement</td>
			<td>
				<select name="Judgement">
					<option<%= s.getJudgement().equalsIgnoreCase("N/A") ? " selected=\"selected\"" : "" %>>N/A</option>
					<option<%= s.getJudgement().equalsIgnoreCase("AC") ? " selected=\"selected\"" : "" %>>AC</option>
					<option<%= s.getJudgement().equalsIgnoreCase("CE") ? " selected=\"selected\"" : "" %>>CE</option>
					<option<%= s.getJudgement().equalsIgnoreCase("WA") ? " selected=\"selected\"" : "" %>>WA</option>
					<option<%= s.getJudgement().equalsIgnoreCase("TLE") ? " selected=\"selected\"" : "" %>>TLE</option>
					<option<%= s.getJudgement().equalsIgnoreCase("MLE") ? " selected=\"selected\"" : "" %>>MLE</option>
					<option<%= s.getJudgement().equalsIgnoreCase("RE") ? " selected=\"selected\"" : "" %>>RE</option>
					<option<%= s.getJudgement().equalsIgnoreCase("IE") ? " selected=\"selected\"" : "" %>>IE</option>
					<option<%= s.getJudgement().equalsIgnoreCase("OLE") ? " selected=\"selected\"" : "" %>>OLE</option>
				</select>
			</td>
			<td><input type="submit" value="Change" name="EditJudgement"></td>
		</tr>
		<tr>
			<td>DjudgeFlag</td>
			<td>
				<select name="DjudgeFlag">
					<option<%= s.getDjudgeFlag() == 0 ? " selected=\"selected\"" : "" %> value="0">NEW</option>
					<option<%= s.getDjudgeFlag() < 0 ? " selected=\"selected\"" : "" %> value="-1">@Judge</option>
					<option<%= s.getDjudgeFlag() > 0 ? " selected=\"selected\"" : "" %> value="1">OK</option>
				</select>
			</td>
			<td><input type="submit" value="Change" name="EditDjudgeFlag"></td>
		</tr>
		<tr>
			<td>djudgeFetchDate</td>
			<td><%= s.getDjudgeFetchDate()  %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>djudgeCheckDate</td>
			<td><%= s.getDjudgeCheckDate()  %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>sourceSize</td>
			<td><%= s.getSourceSize()  %></td>
			<td>-</td>
		</tr>
		<tr>
			<td>ipAddress</td>
			<td><%= s.getIpAddress()  %></td>
			<td>-</td>
		</tr>
	</table>
	<input type="submit" value="Change all fields" name="EditAll">
</form>

<%@include file="../footer.jsp"%>